<?php

/**
 * @author Ned
 *
 */
/**
 * @author Ned
 *
 */
class Com_Basil_HBase_Resource_HBaseClient extends Zend_Application_Resource_ResourceAbstract {

	/**
	 * @var String "Stub" or "Json"
	 */
	protected $clientType;
	
	/**
	 * @var String URI to HBase REST server
	 */
	protected $hbaseRestURI;
	
	/**
	 * @var Array
	 */
	protected $params;
	
	private static $properties = array('clientType','hbaseRestURI','params');
	
	public function setClientType($clientType) {
		$this->clientType = $clientType;
	}
	
	public function setHbaseRestURI($uri) {
		$this->hbaseRestURI = $uri;
	}
	
	public function init() {
		$client = $this->factory($this->clientType, $this->hbaseRestURI, $this->params);
		return $client;
	}
	
	public function factory($clientType, $hbaseRestURI, $params) {
		$loader = new Zend_Loader_PluginLoader();
		$loader->addPrefixPath('Com_Basil_HBase_Client','Com/Basil/HBase/Client');
		
		$class = $loader->load($clientType);
		$reflection = new ReflectionClass($class);
		
		$client = $reflection->newInstance($clientType, $hbaseRestURI, $params);
		return $client;
		
	}
}
?>